package com.appwoo.txtws.activity;

import android.app.Activity;
import android.app.AlarmManager;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.res.Resources;
import android.net.wifi.WifiManager;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.CheckBox;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;
import android.widget.TextView;
import com.appwoo.txtws.adapter.ListViewCreator;
import com.appwoo.txtws.adapter.SimpleListAdapter;
import com.appwoo.txtws.app.App;
import com.appwoo.txtws.app.AppActivity;
import com.appwoo.txtws.bean.ApnUtils;
import com.appwoo.txtws.bean.MenuItem;
import com.appwoo.txtws.component.AirPlaneModeStatus;
import com.appwoo.txtws.component.FilterSoft;
import com.appwoo.txtws.component.Global;
import com.appwoo.txtws.component.HomeManage;
import com.appwoo.txtws.component.RqSP;
import com.appwoo.txtws.component.StatusProtect;
import com.appwoo.txtws.service.LocationService;
import com.appwoo.txtws.service.WebTimeControlService;
import com.appwoo.txtws.wheel.widget.AlwaysMarqueeTextView;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ScheduledExecutorService;

public class ParentForChildActivity extends AppActivity
{
  public SimpleListAdapter<MenuItem> adapter1;
  public SimpleListAdapter<MenuItem> adapter2;
  AlwaysMarqueeTextView amtv;
  private int connectionType = -1;
  private GridView gvList;
  private GridView gvList2;
  public List<MenuItem> items1 = new ArrayList();
  public List<MenuItem> items2 = new ArrayList();
  private ImageView ivLeft;
  private LinearLayout llAll;
  private LinearLayout llRight;
  private boolean netDown = false;
  private int netHasConnect = 0;
  private int netType = 1;
  private TextView tvTop;
  private ProgressDialog v_progressDialog;
  private WifiManager wifiManager;

  private void connect(int paramInt)
  {
    switch (paramInt)
    {
    default:
      return;
    case 0:
      turnOnWifi();
      return;
    case 1:
    }
    turnOnApn();
  }

  // ERROR //
  private void connectionDialog()
  {
    // Byte code:
    //   0: aload_0
    //   1: iconst_0
    //   2: putfield 51	com/appwoo/txtws/activity/ParentForChildActivity:netHasConnect	I
    //   5: new 125	android/app/AlertDialog$Builder
    //   8: dup
    //   9: aload_0
    //   10: invokespecial 127	android/app/AlertDialog$Builder:<init>	(Landroid/content/Context;)V
    //   13: astore_1
    //   14: aload_1
    //   15: invokevirtual 131	android/app/AlertDialog$Builder:create	()Landroid/app/AlertDialog;
    //   18: pop
    //   19: aload_0
    //   20: ldc 132
    //   22: aconst_null
    //   23: invokestatic 138	android/widget/LinearLayout:inflate	(Landroid/content/Context;ILandroid/view/ViewGroup;)Landroid/view/View;
    //   26: astore_3
    //   27: aload_1
    //   28: aload_3
    //   29: invokevirtual 142	android/app/AlertDialog$Builder:setView	(Landroid/view/View;)Landroid/app/AlertDialog$Builder;
    //   32: pop
    //   33: aload_3
    //   34: ldc 143
    //   36: invokevirtual 149	android/view/View:findViewById	(I)Landroid/view/View;
    //   39: checkcast 151	android/widget/RadioGroup
    //   42: astore 5
    //   44: aload_3
    //   45: ldc 152
    //   47: invokevirtual 149	android/view/View:findViewById	(I)Landroid/view/View;
    //   50: checkcast 154	android/widget/RadioButton
    //   53: pop
    //   54: aload_3
    //   55: ldc 155
    //   57: invokevirtual 149	android/view/View:findViewById	(I)Landroid/view/View;
    //   60: checkcast 154	android/widget/RadioButton
    //   63: pop
    //   64: aload_1
    //   65: aload_0
    //   66: ldc 156
    //   68: invokevirtual 160	com/appwoo/txtws/activity/ParentForChildActivity:getString	(I)Ljava/lang/String;
    //   71: new 162	com/appwoo/txtws/activity/ParentForChildActivity$15
    //   74: dup
    //   75: aload_0
    //   76: invokespecial 164	com/appwoo/txtws/activity/ParentForChildActivity$15:<init>	(Lcom/appwoo/txtws/activity/ParentForChildActivity;)V
    //   79: invokevirtual 168	android/app/AlertDialog$Builder:setPositiveButton	(Ljava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)Landroid/app/AlertDialog$Builder;
    //   82: pop
    //   83: aload_1
    //   84: aload_0
    //   85: ldc 169
    //   87: invokevirtual 160	com/appwoo/txtws/activity/ParentForChildActivity:getString	(I)Ljava/lang/String;
    //   90: new 171	com/appwoo/txtws/activity/ParentForChildActivity$16
    //   93: dup
    //   94: aload_0
    //   95: invokespecial 172	com/appwoo/txtws/activity/ParentForChildActivity$16:<init>	(Lcom/appwoo/txtws/activity/ParentForChildActivity;)V
    //   98: invokevirtual 175	android/app/AlertDialog$Builder:setNegativeButton	(Ljava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)Landroid/app/AlertDialog$Builder;
    //   101: pop
    //   102: aload_1
    //   103: invokevirtual 178	android/app/AlertDialog$Builder:show	()Landroid/app/AlertDialog;
    //   106: pop
    //   107: aload_0
    //   108: iconst_0
    //   109: putfield 53	com/appwoo/txtws/activity/ParentForChildActivity:netDown	Z
    //   112: aload 5
    //   114: new 180	com/appwoo/txtws/activity/ParentForChildActivity$17
    //   117: dup
    //   118: aload_0
    //   119: invokespecial 181	com/appwoo/txtws/activity/ParentForChildActivity$17:<init>	(Lcom/appwoo/txtws/activity/ParentForChildActivity;)V
    //   122: invokevirtual 185	android/widget/RadioGroup:setOnCheckedChangeListener	(Landroid/widget/RadioGroup$OnCheckedChangeListener;)V
    //   125: return
    //   126: astore 11
    //   128: aload_0
    //   129: iconst_0
    //   130: putfield 53	com/appwoo/txtws/activity/ParentForChildActivity:netDown	Z
    //   133: goto -21 -> 112
    //   136: astore 10
    //   138: aload_0
    //   139: iconst_0
    //   140: putfield 53	com/appwoo/txtws/activity/ParentForChildActivity:netDown	Z
    //   143: aload 10
    //   145: athrow
    //
    // Exception table:
    //   from	to	target	type
    //   102	107	126	java/lang/Exception
    //   102	107	136	finally
  }

  private void dialogExit(Context paramContext)
  {
    View localView = getLayoutInflater().inflate(2130903087, null);
    final Dialog localDialog = new Dialog(paramContext, 2131361814);
    localDialog.setContentView(localView);
    ((CheckBox)localView.findViewById(2131493079));
    TextView localTextView1 = (TextView)localView.findViewById(2131493080);
    TextView localTextView2 = (TextView)localView.findViewById(2131493081);
    localTextView1.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        localDialog.dismiss();
        ParentForChildActivity.this.exitSoft();
      }
    });
    localTextView2.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        try
        {
          if (localDialog.isShowing())
            localDialog.dismiss();
          return;
        }
        catch (Exception localException)
        {
          localException.printStackTrace();
        }
      }
    });
    localDialog.show();
  }

  private void exitSoft()
  {
    HomeManage localHomeManage = HomeManage.getInstance();
    localHomeManage.clearSelf(this);
    new RqSP().setExitVal(1, this);
    if (WebTimeControlService.scheduler != null)
      WebTimeControlService.scheduler.shutdown();
    if (WebTimeControlService.pendingsender != null)
      WebTimeControlService.am.cancel(WebTimeControlService.pendingsender);
    if (WebTimeControlService.myLocationService != null)
      WebTimeControlService.myLocationService.closeLocationTask();
    stopService(new Intent(this, WebTimeControlService.class));
    Intent localIntent = new Intent("send.ok.message");
    localIntent.putExtra("exitval", 1);
    sendBroadcast(localIntent);
    try
    {
      Thread.sleep(1000L);
      localHomeManage.switchTo(this);
      StatusProtect.Hide(getApplicationContext());
      if (App.getMainActivity() != null)
        App.getMainActivity().finish();
      return;
    }
    catch (InterruptedException localInterruptedException)
    {
      while (true)
        localInterruptedException.printStackTrace();
    }
  }

  private void initActionBar()
  {
    hideBarHome();
    hideBarBack();
    setBarTitle(getResources().getString(2131427387));
    setBarBackOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        ParentForChildActivity.this.finish();
      }
    });
  }

  private void initMenuItems()
  {
    this.items1.add(new MenuItem(getString(2131427346), getResources().getDrawable(2130838017), new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        if (!ParentForChildActivity.this.isNetworkAvailable(ParentForChildActivity.this))
        {
          ParentForChildActivity.this.connectionDialog();
          return;
        }
        ParentForChildActivity.this.IntentActivity(ParentForChildActivity.this, MarketTabActivity.class);
      }
    }));
    this.items1.add(new MenuItem(getString(2131427342), getResources().getDrawable(2130838018), new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        ParentForChildActivity.this.IntentActivity(ParentForChildActivity.this, AppListForChildTabActivity.class);
      }
    }));
    this.items1.add(new MenuItem(getString(2131427343), getResources().getDrawable(2130838019), new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        if (!ParentForChildActivity.this.isNetworkAvailable(ParentForChildActivity.this))
        {
          ParentForChildActivity.this.connectionDialog();
          return;
        }
        ParentForChildActivity.this.IntentActivity(ParentForChildActivity.this, QQPhoneActivity.class);
      }
    }));
    this.items1.add(new MenuItem(getString(2131427344), getResources().getDrawable(2130838020), new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        if (!ParentForChildActivity.this.isNetworkAvailable(ParentForChildActivity.this))
        {
          ParentForChildActivity.this.connectionDialog();
          return;
        }
        ParentForChildActivity.this.IntentActivity(ParentForChildActivity.this, TimeFunStuActivity.class);
      }
    }));
    this.items1.add(new MenuItem(getString(2131428211), getResources().getDrawable(2130838021), new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        new RqSP().setExitVal(0, ParentForChildActivity.this);
        if (ParentForChildActivity.this.connectionType != -1)
        {
          if (Global.systemVersion < 9)
            ApnUtils.setApnState(ParentForChildActivity.this, false);
          AirPlaneModeStatus.setMobile(ParentForChildActivity.this, false);
          AirPlaneModeStatus.setWifi(ParentForChildActivity.this, false);
        }
        ParentForChildActivity.this.finish();
      }
    }));
    this.items1.add(new MenuItem(getString(2131427347), getResources().getDrawable(2130838030), new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        ParentForChildActivity.this.IntentActivity(ParentForChildActivity.this, UserInfoDisplayActivity.class);
      }
    }));
    this.adapter1 = new SimpleListAdapter(this.items1, new ListViewCreator()
    {
      public View createView(MenuItem paramAnonymousMenuItem, View paramAnonymousView, int paramAnonymousInt)
      {
        if (paramAnonymousView == null)
          paramAnonymousView = App.getLayoutInflater().inflate(2130903111, null);
        ((ImageView)paramAnonymousView.findViewById(2131493123)).setImageDrawable(paramAnonymousMenuItem.getDrawable());
        ((TextView)paramAnonymousView.findViewById(2131493124)).setText(paramAnonymousMenuItem.getName());
        paramAnonymousView.setOnClickListener(paramAnonymousMenuItem.getListener());
        paramAnonymousView.setPressed(true);
        return paramAnonymousView;
      }
    });
    this.gvList.setAdapter(this.adapter1);
  }

  private void initMenuItems2()
  {
    this.items2.add(new MenuItem(getString(2131427348), getResources().getDrawable(2130838027), new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        if (!ParentForChildActivity.this.isNetworkAvailable(ParentForChildActivity.this))
        {
          ParentForChildActivity.this.connectionDialog();
          return;
        }
        ParentForChildActivity.this.IntentActivity(ParentForChildActivity.this, MoreSetActivity.class);
      }
    }));
    this.items2.add(new MenuItem(getString(2131427728), getResources().getDrawable(2130838028), new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        if (!ParentForChildActivity.this.isNetworkAvailable(ParentForChildActivity.this))
        {
          ParentForChildActivity.this.connectionDialog();
          return;
        }
        ParentForChildActivity.this.IntentActivity(ParentForChildActivity.this, InviteActivity.class);
      }
    }));
    this.items2.add(new MenuItem(getString(2131427349), getResources().getDrawable(2130838031), new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        ParentForChildActivity.this.IntentActivity(ParentForChildActivity.this, AboutActivity.class);
      }
    }));
    if (!FilterSoft.IsCustomVersion())
      this.items2.add(new MenuItem(getString(2131428052), getResources().getDrawable(2130838024), new View.OnClickListener()
      {
        public void onClick(View paramAnonymousView)
        {
          ParentForChildActivity.this.dialogExit(ParentForChildActivity.this);
        }
      }));
    this.adapter2 = new SimpleListAdapter(this.items2, new ListViewCreator()
    {
      public View createView(MenuItem paramAnonymousMenuItem, View paramAnonymousView, int paramAnonymousInt)
      {
        if (paramAnonymousView == null)
          paramAnonymousView = App.getLayoutInflater().inflate(2130903112, null);
        ((ImageView)paramAnonymousView.findViewById(2131493123)).setImageDrawable(paramAnonymousMenuItem.getDrawable());
        ((TextView)paramAnonymousView.findViewById(2131493124)).setText(paramAnonymousMenuItem.getName());
        paramAnonymousView.setOnClickListener(paramAnonymousMenuItem.getListener());
        paramAnonymousView.setPressed(true);
        return paramAnonymousView;
      }
    });
    this.gvList2.setAdapter(this.adapter2);
  }

  private void initView()
  {
    this.llRight = ((LinearLayout)findViewById(2131493311));
    this.llAll = ((LinearLayout)findViewById(2131493307));
    this.tvTop = ((TextView)findViewById(2131493309));
    this.gvList = ((GridView)findViewById(2131493308));
    this.gvList2 = ((GridView)findViewById(2131493312));
    this.ivLeft = ((ImageView)findViewById(2131493310));
    this.ivLeft.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        if (ParentForChildActivity.this.llAll.getScrollX() != 0)
        {
          ParentForChildActivity.this.ivLeft.setImageDrawable(ParentForChildActivity.this.getResources().getDrawable(2130838070));
          ParentForChildActivity.this.tvTop.setVisibility(8);
          ParentForChildActivity.this.llAll.scrollTo(ParentForChildActivity.this.llAll.getScrollX() - ParentForChildActivity.this.llRight.getWidth(), ParentForChildActivity.this.llAll.getScrollY());
          ParentForChildActivity.this.gvList.setEnabled(true);
          return;
        }
        ParentForChildActivity.this.ivLeft.setImageDrawable(ParentForChildActivity.this.getResources().getDrawable(2130838071));
        ParentForChildActivity.this.tvTop.setVisibility(0);
        ParentForChildActivity.this.gvList.setEnabled(false);
        ParentForChildActivity.this.llAll.scrollTo(ParentForChildActivity.this.llAll.getScrollX() + ParentForChildActivity.this.llRight.getWidth(), ParentForChildActivity.this.llAll.getScrollY());
      }
    });
    this.tvTop.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        ParentForChildActivity.this.ivLeft.setImageDrawable(ParentForChildActivity.this.getResources().getDrawable(2130838070));
        ParentForChildActivity.this.tvTop.setVisibility(8);
        ParentForChildActivity.this.llAll.scrollTo(ParentForChildActivity.this.llAll.getScrollX() - ParentForChildActivity.this.llRight.getWidth(), ParentForChildActivity.this.llAll.getScrollY());
        ParentForChildActivity.this.gvList.setEnabled(true);
      }
    });
  }

  private void turnOnApn()
  {
    this.netType = 2;
    new CheckWifi_AsyncTask().execute(new String[] { "check" });
  }

  private void turnOnWifi()
  {
    this.netType = 1;
    new CheckWifi_AsyncTask().execute(new String[] { "check" });
  }

  protected void backKeyCallBack()
  {
    finish();
  }

  public void onBackPressed()
  {
    finish();
  }

  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903158);
    initActionBar();
    initView();
    initMenuItems();
    initMenuItems2();
  }

  public class CheckWifi_AsyncTask extends AsyncTask<String, Intent, String>
  {
    private String method = "";

    public CheckWifi_AsyncTask()
    {
    }

    protected String doInBackground(String[] paramArrayOfString)
    {
      this.method = paramArrayOfString[0];
      if (this.method.equals("check"))
      {
        if (ParentForChildActivity.this.netType != 1)
          break label64;
        ParentForChildActivity.this.wifiManager = ((WifiManager)ParentForChildActivity.this.getSystemService("wifi"));
        ParentForChildActivity.this.wifiManager.setWifiEnabled(true);
      }
      while (true)
      {
        return "";
        label64: AirPlaneModeStatus.setWifi(ParentForChildActivity.this, false);
        AirPlaneModeStatus.setMobile(ParentForChildActivity.this, true);
        if (Global.systemVersion < 9)
          ApnUtils.setApnState(ParentForChildActivity.this, true);
      }
    }

    protected void onPostExecute(String paramString)
    {
      if (this.method.equals("check"))
      {
        if (ParentForChildActivity.this.netType != 1)
          break label50;
        ParentForChildActivity.this.alertMessage(ParentForChildActivity.this.getString(2131427738));
      }
      try
      {
        while (true)
        {
          ParentForChildActivity.this.v_progressDialog.dismiss();
          return;
          label50: ParentForChildActivity.this.alertMessage(ParentForChildActivity.this.getString(2131427739));
        }
      }
      catch (Exception localException)
      {
      }
    }

    protected void onPreExecute()
    {
      if ((ParentForChildActivity.this.v_progressDialog == null) || (!ParentForChildActivity.this.v_progressDialog.isShowing()))
      {
        ParentForChildActivity.this.v_progressDialog = new ProgressDialog(ParentForChildActivity.this);
        ParentForChildActivity.this.v_progressDialog.setMessage(ParentForChildActivity.this.getString(2131427737));
        ParentForChildActivity.this.v_progressDialog.setCancelable(true);
      }
      try
      {
        ParentForChildActivity.this.v_progressDialog.show();
        return;
      }
      catch (Exception localException)
      {
      }
    }
  }
}

/* Location:           C:\Documents and Settings\Administrator\classes_dex2jar.jar
 * Qualified Name:     com.appwoo.txtws.activity.ParentForChildActivity
 * JD-Core Version:    0.6.2
 */